package com.xin.di.uav.applet.mapper;

import com.xin.di.uav.operate.po.SysRolePermissionPO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysRolePermissionMapper {


    @Insert({"<script>",
            "insert into sys_role_permission (role_id, permission_id)\n" +
                    "values (#{roleId},#{permissionId})",
            "</script>"})
    int insert(SysRolePermissionPO sysRolePermissionPO);


    @Select({"<script>",
            "select role_id,permission_id from sys_role_permission where role_id in ",
            "       <foreach item=\"id\" collection=\"ids\" open=\"(\" separator=\",\" close=\")\">\n" +
                    "            #{id}\n" +
                    "        </foreach>" +
            "</script>"})
    List<SysRolePermissionPO> selByIds(@Param("ids") List<String> ids);


    @Delete({"<script>",
            "delete from sys_role_permission where role_id=#{roleId}",
            "</script>"})
    int deleteByRoleId(String roleId);
}
